<?php

namespace frontend\models;

use common\models\Report;
use Yii;
use yii\base\Model;

/**
 * ContactForm is the model behind the contact form.
 */
class ReportForm extends Model
{
    public $reason;
    public $id;


    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            // name, email, subject and body are required
            ['reason', 'required','message'=>'请输入举报理由'],
            [['id'], 'integer'],

        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'reason' => '举报理由',
        ];
    }

    /**
     * Sends an email to the specified email address using the information collected by this model.
     *
     * @param  string  $email the target email address
     * @return boolean whether the email was sent
     */
    public function saveReport()
    {
        if($this->validate()){
            $repost = new Report();
            $repost->user_id =Yii::$app->user->id;
          //  $repost-
        }
    }
}
